/*
 * @file cookie 封装
 * @author:wy
 */



    module.exports = {

        /**
         * 设置cookie
         * @param {*} name 
         * @param {*} value 
         * @param {*} time 
         */
        set: function(name, value, time) {
            let _date = new Date();
            _date.setDate(_date.getDate()+time - 1);
            document.cookie = `${name}=${value};expires=${_date}`;
        },

        get: function(name) {
            var arr = document.cookie.split(";");
            for(var i=0;i<arr.length;i++){
                var arr2 = arr[i].split("=");
                if(arr2[0]==name){
                    return arr2[1]
                }
            }
            return ""
        },

        remove: function(name) {
            this.set(name,1,-1);
        }
    }
